package com.ecy.quadratic.widget;

import android.view.GestureDetector;
import android.view.MotionEvent;


/**
 * Provided default implementation of GestureDetector.OnDoubleTapListener, to be overriden with custom behavior, if needed
 * <p>&nbsp;</p>
 * To be used via {@link uk.co.senab.photoview.PhotoViewAttacher#setOnDoubleTapListener(GestureDetector.OnDoubleTapListener)}
 */
public class CustomOnDoubleTapListener extends DefaultOnDoubleTapListener {
    ComicReadCallback mCallback;

    /**
     * Default constructor
     *
     * @param photoViewAttacher PhotoViewAttacher to bind to
     */
    public CustomOnDoubleTapListener(PhotoViewAttacher photoViewAttacher) {
        super(photoViewAttacher);
    }

    @Override
    public boolean onSingleTapConfirmed(MotionEvent e) {
        if (mCallback != null) {
            mCallback.onClick();
        }
        return super.onSingleTapConfirmed(e);
    }

    public void setComicBarCallback(ComicReadCallback callback) {
        mCallback = callback;
    }

    public ComicReadCallback getCallback() {
        return mCallback;
    }
}

